package PTA;

import java.util.Scanner;

public class Pta10 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.next();
        StringBuilder sb = new StringBuilder();
        while (true) {
            if (line.equals("end")) {
                break;
            } else {
                if (line.length() % 3 == 0) {
                    sb.append(line);
                    sb.append(" ");
                }
            }
            line = sc.next();
        }
        System.out.println(sb);
    }
}

